<template>
  <a-card :bordered="false">
    <a-spin :spinning="spinning != 0">
      <!-- 查询区域-->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="8">
              <a-form-item :label="$t('m.system.sysconfig.entity.configCode')">
                <a-input placeholder="" v-model="queryParam.configCode$lk"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item :label="$t('m.system.sysconfig.entity.configName')">
                <a-input placeholder="" v-model="queryParam.configName$lk"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                <a-button type="primary" @click="searchQuery" icon="search">{{ $t('m.common.button.query') }}</a-button>
                <a-button type="default" @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('m.common.button.reset') }}</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>

      <!-- table区域-begin -->
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="pagination"
        @change="handleTableChange">
          <template slot="serialNum" slot-scope="text,record,index">
            {{(pagination.current-1) * pagination.pageSize + parseInt(index) + 1}}
          </template>
          <span slot="action" slot-scope="text, record">
            <a @click="handleEdit(record)" v-test>{{ $t('m.common.button.update') }}</a>
          </span>

      </a-table>
    </a-spin>

    <!-- 表单区域 -->
    <SysconfigformDialog ref="form" @refreshParent="modalFormOk"/>

  </a-card>
</template>

<script>

  import { ViewMixin } from '@/mixins/ViewMixin'
  import SysconfigformDialog from './modules/SysconfigformDialog'
  import YchConstant from "@/api/YchConstant";

  export default {
    name: 'SysConfigManageList',
    mixins: [ViewMixin],
    components: {
      SysconfigformDialog,
    },
    data () {
      return {
        columns: [
          {
            title:this.$t('m.common.label.number'),
            dataIndex: '',
            key: 'rowIndex',
            width: 50,
            align: 'center',
            scopedSlots: { customRender: 'serialNum' },
          },
          {
            title: this.$t('m.system.sysconfig.entity.configCode'),
            dataIndex: 'configCode',
            width: 180,
            align: 'center',
          },
          {
            title: this.$t('m.system.sysconfig.entity.configName'),
            dataIndex: 'configName',
            width: 260,
            align: 'left',
            ellipsis: true,
          },
          {
            title: this.$t('m.system.sysconfig.entity.configValue'),
            dataIndex: 'configValue',
            width: 180,
            align: 'center',
          },
          {
            title: this.$t('m.common.label.operate'),
            dataIndex: 'action',
            align: 'center',
            width: 80,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: YchConstant.PREFIX_SYSTEM + '/sysconfig/list',
        },
      }
    },
  }
</script>
<style lang="less" scoped>

</style>
